﻿using System;

using System.Collections;

using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using Global.Class.Library;
using BusinessLogicLayer;
using BusinessLogicLayer.MetaDataList;
using DataAccessLayer;
using DataTransferObject;
using DataTransferObject.MetaDataList;
using System.Globalization;
using BrightIdeasSoftware;
using Equin.ApplicationFramework;

namespace PresentationLayer
{
    public partial class ListItemCommodity : Form, IMergeToolStrip, ICallToolStrip
    {

        #region <Implement Interface>

        public event PropertyChangedEventHandler PropertyChanged;

        private void NotifyPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }

        public GlobalEnum.TaskID TaskID
        {
            get { return this.listItemCommodityBLL.TaskID; }
        }


        public ToolStrip ChildToolStrip
        {
            get
            {
                return this.toolStripChildForm;
            }
            set
            {
                this.toolStripChildForm = value;
            }
        }





        #region Context toolbar


        public bool IsDirty
        {
            get { return this.listItemCommodityBLL.IsDirty; }
        }

        public bool IsValid
        {
            get { return this.listItemCommodityBLL.IsValid; }
        }

        public bool Closable
        {
            get { return true; }
        }

        public bool Loadable
        {
            get { return true; }
        }

        public bool Newable
        {
            get { return !this.listItemCommodityBLL.ReadOnly; }
        }

        public bool Editable
        {
            get { return !this.listItemCommodityBLL.ReadOnly; }
        }

        public bool Deletable
        {
            get { return this.listItemCommodityBLL.Editable; }
        }

        public bool Importable
        {
            get { return false; }
        }

        public bool Exportable
        {
            get { return false; }
        }

        public bool Verifiable
        {
            get { return this.listItemCommodityBLL.Verifiable; }
        }

        public bool Unverifiable
        {
            get { return this.listItemCommodityBLL.Unverifiable; }
        }

        public bool Printable
        {
            get { return false; }
        }

        public bool Searchable
        {
            get { return true; }
        }

        /// <summary>
        /// Edit Mode: True, Read Mode: False
        /// </summary>
        private bool editableMode;
        private int lastItemCommodityID;
        public bool EditableMode { get { return this.editableMode; } }
        /// <summary>
        /// This reverse of the EditableMode
        /// </summary>
        public bool ReadonlyMode { get { return !this.editableMode; } }

        /// <summary>
        /// Set the editableMode
        /// </summary>
        /// <param name="editableMode"></param>
        private void SetEditableMode(bool editableMode)
        {
            if (this.editableMode != editableMode)
            {
                this.lastItemCommodityID = this.listItemCommodityBLL.CommodityID;
                this.editableMode = editableMode;
                this.NotifyPropertyChanged("EditableMode");

                this.naviGroupDetails.Expanded = editableMode;
            }
        }


        private void CancelDirty(bool restoreSavedData)
        {
            try
            {
                if (restoreSavedData || this.listItemCommodityBLL.CommodityID <= 0)
                    this.listItemCommodityBLL.Fill(this.lastItemCommodityID);

                this.SetEditableMode(false);
            }
            catch (Exception exception)
            {
                throw exception;
            }
        }



        #endregion Context toolbar



        #region ICallToolStrip

        public void Escape()
        {
            if (this.EditableMode)
            {
                if (this.IsDirty)
                {
                    DialogResult dialogResult = MessageBox.Show(this, "Do you want to save your change?", "Warning", MessageBoxButtons.YesNoCancel);
                    if (dialogResult == DialogResult.Yes)
                    {
                        this.Save();
                        if (!this.IsDirty) this.CancelDirty(false);
                    }
                    else if (dialogResult == DialogResult.No)
                    {
                        this.CancelDirty(true);
                    }
                    else
                        return;
                }
                else
                    this.CancelDirty(false);
            }
            else
                this.Close(); //Unload this module
        }


        public void Loading()
        {
            this.GetMasterList();
        }

        public void New()
        {
            this.listItemCommodityBLL.New();
            this.SetEditableMode(true);
        }

        public void Edit()
        {
            this.SetEditableMode(true);
        }

        public void Save()
        {
            this.listItemCommodityBLL.Save();
            this.GetMasterList();
        }

        public void Delete()
        {
            DialogResult dialogResult = MessageBox.Show(this, "Are you sure you want to delete " + this.listItemCommodityBLL.ListItemCommodityMaster.Description + "?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Stop);
            if (dialogResult == DialogResult.Yes)
            {
                try
                {
                    this.listItemCommodityBLL.Delete();
                    this.GetMasterList();
                }
                catch (Exception exception)
                {
                    GlobalExceptionHandler.ShowExceptionMessageBox(this, exception);
                }
            }
        }

        public void Import()
        {
            ImportExcel();
        }

        public void Export()
        {
            try
            {
            }
            catch (Exception exception)
            {
                GlobalExceptionHandler.ShowExceptionMessageBox(this, exception);
            }
        }

        public void Verify()
        {
            MessageBox.Show("Verify");
        }

        public void Print(PrintDestination printDestination)
        {
            MessageBox.Show("Print");
        }

        public void SearchText(string searchText)
        {

        }

        #endregion


        #endregion <Implement Interface>








        #region <Storage>
        private ListItemCommodityBLL listItemCommodityBLL;

        private int filterAddressAreaID = -1;
        private int filterSalesmenCategoryID = -1;


        [DefaultValue(0)]
        public int FilterAddressAreaID
        {
            get { return this.filterAddressAreaID; }
            set
            {
                if (this.filterAddressAreaID != value)
                {
                    this.filterAddressAreaID = value;
                    this.GetMasterList();//this.NotifyPropertyChanged("FilterAddressAreaID");
                }
            }
        }

        [DefaultValue(0)]
        public int FilterSalesmenCategoryID
        {
            get { return this.filterSalesmenCategoryID; }
            set
            {
                if (this.filterSalesmenCategoryID != value)
                {
                    this.filterSalesmenCategoryID = value;
                    this.GetMasterList();//this.NotifyPropertyChanged("FilterCustomerCategoryID");
                }
            }
        }

        #endregion <Storage>


        public ListItemCommodity()
        {
            try
            {
                InitializeComponent();

                this.listItemCommodityBLL = new ListItemCommodityBLL();

                this.listItemCommodityBLL.PropertyChanged += new PropertyChangedEventHandler(listItemCommodityBLL_PropertyChanged);

            }
            catch (Exception exception)
            {
                GlobalExceptionHandler.ShowExceptionMessageBox(this, exception);
            }
        }

        void listItemCommodityBLL_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            this.NotifyPropertyChanged(e.PropertyName);
        }


        private void ListItemCommodity_Load(object sender, EventArgs e)
        {
            try
            {
                InitializeTabControl();

                InitializeCommonControlBinding();

                InitializeDataGridBinding();

                InitializeReadOnlyModeBinding();
            }
            catch (Exception exception)
            {
                GlobalExceptionHandler.ShowExceptionMessageBox(this, exception);
            }
        }


        private void InitializeTabControl()
        {
            try
            {
                CustomTabControl customTabControlItemCommodity = new CustomTabControl();

                customTabControlItemCommodity.ImageList = this.imageListTabControl;


                customTabControlItemCommodity.TabPages.Add("ItemCommodity", "Commodity    ", 6);
                customTabControlItemCommodity.TabPages[0].Controls.Add(this.dataGridViewListItemCommodityDetail);
                this.dataGridViewListItemCommodityDetail.Dock = DockStyle.Fill;


                customTabControlItemCommodity.DisplayStyle = TabStyle.VisualStudio;
                customTabControlItemCommodity.DisplayStyleProvider.ImageAlign = ContentAlignment.MiddleLeft;
                this.naviGroupDetails.Controls.Add(customTabControlItemCommodity);
                this.naviGroupDetails.Controls.SetChildIndex(customTabControlItemCommodity, 0);
                customTabControlItemCommodity.Dock = DockStyle.Fill;

                customTabControlItemCommodity.Visible = false; //No need to show
            }
            catch (Exception exception)
            {
                GlobalExceptionHandler.ShowExceptionMessageBox(this, exception);
            }
        }


        #region <InitializeBinding>


        Binding itemCategoryIDBinding;
        Binding itemBrandIDBinding;
        Binding itemTypeIDBinding;
        Binding itemGroupIDBinding;
        Binding itemClassBinding;
        Binding itemPM_APMIDBinding;
        Binding supplierIDBinding;

        Binding descriptionBinding;
        Binding descriptionOfficialBinding;
        Binding unitBinding;
        Binding packingBinding;
        Binding weightBinding;
        Binding originBinding;
        Binding leadTimeBinding;
        Binding otherBinding;


        Binding isOrderBinding;
        Binding isPromotionBinding;
        Binding isSampleBinding;
        Binding isMerchandisingBinding;

        Binding isDirtyBinding;
        Binding isDirtyBLLBinding;

        private void InitializeCommonControlBinding()
        {
            CommonMetaList commonMetaList = new CommonMetaList();

            ERmgrUIP.ListItemCategoryDataTable listItemCategoryDataTable = commonMetaList.GetItemCategory();
            this.comboBoxItemCategoryID.DataSource = listItemCategoryDataTable;
            this.comboBoxItemCategoryID.DisplayMember = listItemCategoryDataTable.DescriptionColumn.ColumnName;
            this.comboBoxItemCategoryID.ValueMember = listItemCategoryDataTable.ItemCategoryIDColumn.ColumnName;
            this.itemCategoryIDBinding = this.comboBoxItemCategoryID.DataBindings.Add("SelectedValue", this.listItemCommodityBLL.ListItemCommodityMaster, "ItemCategoryID", true);

            ERmgrUIP.ListItemBrandDataTable listItemBrandDataTable = commonMetaList.GetItemBrand();
            this.comboBoxItemBrandID.DataSource = listItemBrandDataTable;
            this.comboBoxItemBrandID.DisplayMember = listItemBrandDataTable.DescriptionColumn.ColumnName;
            this.comboBoxItemBrandID.ValueMember = listItemBrandDataTable.ItemBrandIDColumn.ColumnName;
            this.itemBrandIDBinding = this.comboBoxItemBrandID.DataBindings.Add("SelectedValue", this.listItemCommodityBLL.ListItemCommodityMaster, "ItemBrandID", true);

            ERmgrUIP.ListItemTypeDataTable listItemItemTypeDataTable = commonMetaList.GetItemType();
            this.comboBoxItemTypeID.DataSource = listItemItemTypeDataTable;
            this.comboBoxItemTypeID.DisplayMember = listItemItemTypeDataTable.DescriptionColumn.ColumnName;
            this.comboBoxItemTypeID.ValueMember = listItemItemTypeDataTable.ItemTypeIDColumn.ColumnName;
            this.itemTypeIDBinding = this.comboBoxItemTypeID.DataBindings.Add("SelectedValue", this.listItemCommodityBLL.ListItemCommodityMaster, "ItemTypeID", true);

            ERmgrUIP.ListItemGroupDataTable listItemGroupDataTable = commonMetaList.GetItemGroup();
            this.comboBoxItemGroupID.DataSource = listItemGroupDataTable;
            this.comboBoxItemGroupID.DisplayMember = listItemGroupDataTable.DescriptionColumn.ColumnName;
            this.comboBoxItemGroupID.ValueMember = listItemGroupDataTable.ItemGroupIDColumn.ColumnName;
            this.itemGroupIDBinding = this.comboBoxItemGroupID.DataBindings.Add("SelectedValue", this.listItemCommodityBLL.ListItemCommodityMaster, "ItemGroupID", true);

            ERmgrUIP.ListItemClassDataTable listItemClassDataTable = commonMetaList.GetItemClass();
            this.comboBoxItemClassID.DataSource = listItemClassDataTable;
            this.comboBoxItemClassID.DisplayMember = listItemClassDataTable.DescriptionColumn.ColumnName;
            this.comboBoxItemClassID.ValueMember = listItemClassDataTable.ItemClassIDColumn.ColumnName;
            this.itemClassBinding = this.comboBoxItemClassID.DataBindings.Add("SelectedValue", this.listItemCommodityBLL.ListItemCommodityMaster, "ItemClassID", true);

            ERmgrUIP.ListItemPM_APMDataTable listItemPM_APMDataTable = commonMetaList.GetItemPM_APM();
            this.comboBoxItemPM_APMID.DataSource = listItemPM_APMDataTable;
            this.comboBoxItemPM_APMID.DisplayMember = listItemPM_APMDataTable.DescriptionColumn.ColumnName;
            this.comboBoxItemPM_APMID.ValueMember = listItemPM_APMDataTable.ItemPM_APMIDColumn.ColumnName;
            this.itemPM_APMIDBinding = this.comboBoxItemPM_APMID.DataBindings.Add("SelectedValue", this.listItemCommodityBLL.ListItemCommodityMaster, "ItemPM_APMID", true);

            ERmgrUIP.ListSupplierNameDataTable listSupplierNameDataTable = commonMetaList.GetSupplierName();
            this.comboBoxSupplierID.DataSource = listSupplierNameDataTable;
            this.comboBoxSupplierID.DisplayMember = listSupplierNameDataTable.DescriptionColumn.ColumnName;
            this.comboBoxSupplierID.ValueMember = listSupplierNameDataTable.SupplierIDColumn.ColumnName;
            this.supplierIDBinding = this.comboBoxSupplierID.DataBindings.Add("SelectedValue", this.listItemCommodityBLL.ListItemCommodityMaster, "SupplierID", true);


            this.descriptionBinding = this.textBoxDescription.DataBindings.Add("Text", this.listItemCommodityBLL.ListItemCommodityMaster, "Description", true);
            this.descriptionOfficialBinding = this.textBoxDescriptionOfficial.DataBindings.Add("Text", this.listItemCommodityBLL.ListItemCommodityMaster, "DescriptionOfficial", true);
            this.unitBinding = this.textBoxUnit.DataBindings.Add("Text", this.listItemCommodityBLL.ListItemCommodityMaster, "Unit", true);
            this.packingBinding = this.textBoxPacking.DataBindings.Add("Text", this.listItemCommodityBLL.ListItemCommodityMaster, "Packing", true);
            this.weightBinding = this.textBoxWeight.DataBindings.Add("Text", this.listItemCommodityBLL.ListItemCommodityMaster, "Weight", true);
            this.originBinding = this.textBoxOrigin.DataBindings.Add("Text", this.listItemCommodityBLL.ListItemCommodityMaster, "Origin", true);
            this.leadTimeBinding = this.textBoxLeadTime.DataBindings.Add("Text", this.listItemCommodityBLL.ListItemCommodityMaster, "LeadTime", true);
            this.otherBinding = this.textBoxOther.DataBindings.Add("Text", this.listItemCommodityBLL.ListItemCommodityMaster, "Other", true);

            this.isOrderBinding = this.checkBoxIsOther.DataBindings.Add("Checked", this.listItemCommodityBLL.ListItemCommodityMaster, "IsOrder", true);
            this.isPromotionBinding = this.checkBoxIsPromotion.DataBindings.Add("Checked", this.listItemCommodityBLL.ListItemCommodityMaster, "IsPromotion", true);
            this.isSampleBinding = this.checkBoxIsSample.DataBindings.Add("Checked", this.listItemCommodityBLL.ListItemCommodityMaster, "IsSample", true);
            this.isMerchandisingBinding = this.checkBoxIsMerchandising.DataBindings.Add("Checked", this.listItemCommodityBLL.ListItemCommodityMaster, "IsMerchandising", true);

            this.isDirtyBinding = this.checkBoxIsDirty.DataBindings.Add("Checked", this.listItemCommodityBLL.ListItemCommodityMaster, "IsDirty", true);
            this.isDirtyBLLBinding = this.checkBoxIsDirtyBLL.DataBindings.Add("Checked", this.listItemCommodityBLL, "IsDirty", true);




            this.itemCategoryIDBinding.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete);
            this.itemBrandIDBinding.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete);
            this.itemTypeIDBinding.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete);
            this.itemGroupIDBinding.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete);
            this.itemClassBinding.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete);
            this.itemPM_APMIDBinding.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete);
            this.supplierIDBinding.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete);


            this.descriptionBinding.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete);
            this.descriptionOfficialBinding.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete);
            this.unitBinding.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete);
            this.packingBinding.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete);
            this.weightBinding.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete);
            this.originBinding.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete);
            this.leadTimeBinding.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete);
            this.otherBinding.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete);


            this.isOrderBinding.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete);
            this.isPromotionBinding.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete);
            this.isSampleBinding.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete);
            this.isMerchandisingBinding.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete);



            this.isDirtyBinding.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete);
            this.isDirtyBLLBinding.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete);


            this.naviGroupDetails.DataBindings.Add("ExpandedHeight", this.numericUpDownSizingDetail, "Value", true, DataSourceUpdateMode.OnPropertyChanged);
            this.numericUpDownSizingDetail.Minimum = this.naviGroupDetails.HeaderHeight * 2;
            this.numericUpDownSizingDetail.Maximum = this.naviGroupDetails.Height + this.dataTreeListViewMaster.Height;

            this.tableLayoutPanelMaster.ColumnStyles[this.tableLayoutPanelMaster.ColumnCount - 1].SizeType = SizeType.Absolute; this.tableLayoutPanelMaster.ColumnStyles[this.tableLayoutPanelMaster.ColumnCount - 1].Width = 10;

            this.errorProviderMaster.DataSource = this.listItemCommodityBLL.ListItemCommodityMaster;
        }


        private void CommonControl_BindingComplete(object sender, BindingCompleteEventArgs e)
        {
            if (e.BindingCompleteState == BindingCompleteState.Exception) { GlobalExceptionHandler.ShowExceptionMessageBox(this, e.ErrorText); e.Cancel = true; }
        }

        private void numericUpDownSizingDetail_ValueChanged(object sender, EventArgs e)
        {
            this.naviGroupDetails.Expand();
        }

        private void naviGroupDetails_HeaderMouseClick(object sender, MouseEventArgs e)
        {
            this.numericUpDownSizingDetail.Visible = this.naviGroupDetails.Expanded;
        }



        private void InitializeDataGridBinding()
        {

            this.GetMasterList();



            #region <dataGridViewDetail>

            this.dataGridViewListItemCommodityDetail.AutoGenerateColumns = false;
            listItemCommodityDetailView = new BindingListView<ListItemCommodityDetail>(this.listItemCommodityBLL.ListItemCommodityDetailList);
            this.dataGridViewListItemCommodityDetail.DataSource = listItemCommodityDetailView;

            StackedHeaderDecorator stackedHeaderDecorator = new StackedHeaderDecorator(this.dataGridViewListItemCommodityDetail);


            #endregion <dataGridViewDetail>
        }


        private void InitializeReadOnlyModeBinding()
        {
            List<Control> controlList = GlobalStaticFunction.GetAllControls(this);

            foreach (Control control in controlList)
            {
                //if (control is TextBox) control.DataBindings.Add("Readonly", this, "ReadonlyMode");
                if (control is TextBox)
                {
                    if (control.Equals(this.textBoxDescription))
                        control.Enabled = false;
                    else
                        control.DataBindings.Add("Enabled", this, "EditableMode");
                }
                else if (control is ComboBox || control is DateTimePicker || control is CheckBox) control.DataBindings.Add("Enabled", this, "EditableMode");
                else if (control is DataGridView)
                {
                    control.DataBindings.Add("Readonly", this, "ReadonlyMode");
                    control.DataBindings.Add("AllowUserToAddRows", this, "EditableMode");
                    control.DataBindings.Add("AllowUserToDeleteRows", this, "EditableMode");
                }
            }

            this.dataTreeListViewMaster.DataBindings.Add("Enabled", this, "ReadonlyMode");
        }

        BindingListView<ListItemCommodityDetail> listItemCommodityDetailView;


        private enum ListingOptions
        {
            AddressArea = 1,
            SalesmenCategory = 2
        }

        private void GetMasterList()
        {
            try
            {
                DataTable listItemCommodityListingDataTable;

                listItemCommodityListingDataTable = this.listItemCommodityBLL.ListItemCommodityListing();

                listItemCommodityListingDataTable.TableName = "ListItemCommodityListingDataTable";

                DataSet bindingDataSet = new DataSet();
                bindingDataSet.Tables.Add(listItemCommodityListingDataTable);

                this.dataTreeListViewMaster.FullRowSelect = true;
                this.dataTreeListViewMaster.KeyAspectName = "CommodityID";
                this.dataTreeListViewMaster.ParentKeyAspectName = "AncestorID";
                this.dataTreeListViewMaster.RootKeyValue = 0;

                this.dataTreeListViewMaster.DataMember = "ListItemCommodityListingDataTable";
                this.dataTreeListViewMaster.DataSource = new DataViewManager(bindingDataSet);

                this.dataTreeListViewMaster.ExpandAll();
            }
            catch (Exception exception)
            {
                GlobalExceptionHandler.ShowExceptionMessageBox(this, exception);
            }
        }

        #endregion <InitializeBinding>





        #region Import Excel

        private void ImportExcel()
        {
            try
            {

            }
            catch (Exception exception)
            {
                GlobalExceptionHandler.ShowExceptionMessageBox(this, exception);
            }

        }
        #endregion Import Excel



        private void dataTreeListViewMaster_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                ObjectListView objectListView = (ObjectListView)sender;
                DataRowView row = (DataRowView)objectListView.SelectedObject;

                if (row != null)
                {
                    bool isCommodity; int customerTypeID;

                    if (bool.TryParse(row.Row["IsCommodity"].ToString(), out isCommodity))
                        if (isCommodity && int.TryParse(row.Row["CommodityID"].ToString(), out customerTypeID)) this.listItemCommodityBLL.Fill(customerTypeID);
                        else this.listItemCommodityBLL.Fill(0);
                }
                else this.listItemCommodityBLL.Fill(0);
            }
            catch (Exception exception)
            {
                GlobalExceptionHandler.ShowExceptionMessageBox(this, exception);
            }
        }

        private void dataTreeListViewMaster_DoubleClick(object sender, EventArgs e)
        {
            this.naviGroupDetails.Expanded = true;
        }

        private void dataGridView_DataError(object sender, DataGridViewDataErrorEventArgs e)
        {
            GlobalExceptionHandler.ShowExceptionMessageBox(this, e.Exception);
        }

        private void radioButton_CheckedChanged(object sender, EventArgs e)
        {
            if (((RadioButton)sender).Checked)
                this.GetMasterList();
        }

        private void dataGridViewListStaffNameDetail_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
        {
            try
            {
                using (SolidBrush b = new SolidBrush(this.dataGridViewListItemCommodityDetail.RowHeadersDefaultCellStyle.ForeColor))
                {
                    e.Graphics.DrawString((e.RowIndex + 1).ToString(), e.InheritedRowStyle.Font, b, e.RowBounds.Location.X + 15, e.RowBounds.Location.Y + 4);
                }
            }
            catch (Exception exception)
            {
                GlobalExceptionHandler.ShowExceptionMessageBox(this, exception);
            }
        }

    }




}
